import axios from 'axios'

// 模拟咨询相关API接口
const consultApi = {
  /**
   * 获取科室列表
   * @returns {Promise} 科室列表
   */
  getDepartments() {
    // 模拟数据
    return Promise.resolve({
      code: 200,
      data: [
        { id: 1, name: '内科', description: '治疗各种内科疾病' },
        { id: 2, name: '外科', description: '提供外科手术服务' },
        { id: 3, name: '儿科', description: '儿童专科诊疗' },
        { id: 4, name: '妇科', description: '女性健康诊疗' },
        { id: 5, name: '眼科', description: '眼部疾病诊疗' },
        { id: 6, name: '耳鼻喉科', description: '耳鼻喉相关疾病诊疗' }
      ]
    })
  },

  /**
   * 获取队列信息
   * @param {number} departmentId - 科室ID
   * @returns {Promise} 队列信息
   */
  getQueueInfo(departmentId) {
    // 模拟数据
    return Promise.resolve({
      code: 200,
      data: {
        departmentId,
        queueLength: Math.floor(Math.random() * 20) + 1,
        waitTime: Math.floor(Math.random() * 60) + 10,
        currentPosition: Math.floor(Math.random() * 10) + 1
      }
    })
  },

  /**
   * 获取历史记录
   * @returns {Promise} 历史记录列表
   */
  getHistory() {
    // 模拟数据
    return Promise.resolve({
      code: 200,
      data: [
        { id: 1, department: '内科', time: new Date().toISOString(), status: 'completed' },
        { id: 2, department: '儿科', time: new Date(Date.now() - 86400000).toISOString(), status: 'completed' },
        { id: 3, department: '外科', time: new Date(Date.now() - 172800000).toISOString(), status: 'completed' }
      ]
    })
  },

  /**
   * 发起咨询
   * @param {Object} data - 咨询数据
   * @returns {Promise} 咨询结果
   */
  submitConsult(data) {
    // 模拟数据
    return Promise.resolve({
      code: 200,
      data: {
        id: Math.floor(Math.random() * 1000),
        ...data,
        createdAt: new Date().toISOString()
      }
    })
  }
}

export default consultApi